clear
clear matrix
cap log close
set more 1
set matsize 11000
set maxvar 11000
clear



* This file uses the saved estimates from analysis.do to produce the figures demonstrated in the version of the paper found
*here: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2467262  (the figures numbers may have changed with the final version)


* toggle these two to determine figure to produce 
local figure = 1
local figure_script = ""




*********************************************************************************************************

* FIGURE 1

if `figure' == 1 {

clear
use figures/figure_1

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

* Figure 1
eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
}

********************************************************************************************************


********************************************************************************************************
* Figure 2

***************************************

if `figure' == 2 {

* FIGURE 3, A1-A4

clear
use figures/figure_2

gen flag = 0

foreach lname in _cons exp_group2 exp_group3 exp_group4 exp_group5 exp_group6 exp_group7 exp_group8 {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"

gen Group = 1 if parm == "_cons"
replace Group = 2 if parm == "exp_group2"
replace Group = 3 if parm == "exp_group3"
replace Group = 4 if parm == "exp_group4"
replace Group = 5 if parm == "exp_group5"
replace Group = 6 if parm == "exp_group6"
replace Group = 7 if parm == "exp_group7"
replace Group = 8 if parm == "exp_group8"


eclplot estimate min95 max95 Group, xtitle("Group", size(large) margin(small)) yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Group Relative to" "First Experience Group", size(large) margin(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(medium)) xlabel(1 "0-1 Yrs" 2 "2-3 Yrs" 3 "4-5 Yrs" 4 "6-7 Yrs" 5 "8-9 Yrs" 6 "10-11 Yrs" 7 "12-13 Yrs" 8 "14+ Yrs") 

}

***********************************************************************************************************



***********************************************************************************************************\

***********************************
* Figure 3

if `figure' == 3 {

clear
use figures/figure_3

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"


eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Grant Rate at Indicated Grade/Experience" "Group Relative to GS-Level 12 / 1st" "Year Group", size(large) margin(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(medium)) 



}



**************************************************************************************************


***************************************************************************************************

* figure 4


if `figure' == 4 {

clear
use figures/figure_4

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"



eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Obviousness Rejection Share at Indicated" "Grade/Experience Group Relative to" "GS-Level 12 / 1st Year Group", size(large) margin(medium)) scale(.8) legend(on label(1 "Obviousness Rejection Share: Confidence Interval") label(2 "Obviousness Rejection Share: Mean") size(small)) 



}
*******************************************************************************************************************************


***************************************************************************************************

* figure 5


if `figure' == 5 {

clear
use figures/figure_5

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"



eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Obviousness Rejection Rate at Indicated" "Grade/Experience Group Relative to" "GS-Level 12 / 1st Year Group", size(large) margin(medium)) scale(.8) legend(on label(1 "Obviousness Rejection Rate: Confidence Interval") label(2 "Obviousness Rejection Rate: Mean") size(small)) 


}
*******************************************************************************************************************************



*******************************************************************************************************************************

* Figure A1


if "`figure_script'" == "A1" {

use figures/figure_A1

gen flag = 0

foreach lname in _cons first_year2dum3 first_year2dum4 first_year2dum5 first_year2dum6 first_year2dum7 first_year2dum8 first_year2dum9 first_year2dum10 {
replace flag = 1 if parm == "`lname'"
}
foreach lname in first_year2dum11 first_year2dum12 first_year2dum13 first_year2dum14 first_year2dum15 first_year2dum16 first_year2dum17 first_year2dum18 {
replace flag = 1 if parm == "`lname'"
}
foreach lname in first_year2dum19 first_year2dum20 first_year2dum21 {
replace flag = 1 if parm == "`lname'"
}



keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"

gen Cohort = 1993 if parm == "_cons"
replace Cohort = 1994 if parm == "first_year2dum3"
replace Cohort = 1995 if parm == "first_year2dum4"
replace Cohort = 1996 if parm == "first_year2dum5"
replace Cohort = 1997 if parm == "first_year2dum6"
replace Cohort = 1998 if parm == "first_year2dum7"
replace Cohort = 1999 if parm == "first_year2dum8"
replace Cohort = 2000 if parm == "first_year2dum9"
replace Cohort = 2001 if parm == "first_year2dum10"
replace Cohort = 2002 if parm == "first_year2dum11"
replace Cohort = 2003 if parm == "first_year2dum12"
replace Cohort = 2004 if parm == "first_year2dum13"
replace Cohort = 2005 if parm == "first_year2dum14"
replace Cohort = 2006 if parm == "first_year2dum15"
replace Cohort = 2007 if parm == "first_year2dum16"
replace Cohort = 2008 if parm == "first_year2dum17"
replace Cohort = 2009 if parm == "first_year2dum18"
replace Cohort = 2010 if parm == "first_year2dum19"
replace Cohort = 2011 if parm == "first_year2dum20"
replace Cohort = 2012 if parm == "first_year2dum21"


* Figure a15
eclplot estimate min95 max95 Cohort, xtitle("Cohort Year", size(large)) yline(0, lstyle(refline))  ytitle("Grant Rate at Cohort" "Relative to 1993 Cohort", size(large)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) 

}

********************************************************************************************************************


* Figure A2


if "`figure_script'" == "A2" {


use figures/figure_A1

gen flag = 0

foreach lname in _cons max_exp_2 max_exp_3 max_exp_4 max_exp_5 max_exp_6 {
replace flag = 1 if parm == "`lname'"
}



keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Tenure_Group = 1 if parm == "_cons"
replace Tenure_Group = 2 if parm == "max_exp_2"
replace Tenure_Group = 3 if parm == "max_exp_3"
replace Tenure_Group = 4 if parm == "max_exp_4"
replace Tenure_Group = 5 if parm == "max_exp_5"
replace Tenure_Group = 6 if parm == "max_exp_6"


eclplot estimate min95 max95 Tenure_Group, xlabel(1 "0-3 Years" 2 "4-6 Years" 3 "7-9 Years" 4 "10-12 Years" 5 "13-15 Years" 6 "16+ Years")  xtitle("Tenure Group (Total Years of Experience)", size(large)) yline(0, lstyle(refline))  ytitle("Grant Rate at Tenure Group" "Relative to 0-3 Year Tenure Group", size(large)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) 


}



***************************************************************************************

* Figure -- year dummies


if "`figure_script'" == "yeardummies" {


use figures/figure_A1

gen flag = 0

foreach lname in _cons yeardum2 yeardum3 yeardum4 yeardum5 yeardum6 yeardum7 yeardum8 yeardum9 yeardum10 yeardum11 {
replace flag = 1 if parm == "`lname'"
}



keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Year = 2002 if parm == "_cons"
replace Year = 2003 if parm == "yeardum2"
replace Year = 2004 if parm == "yeardum3"
replace Year = 2005 if parm == "yeardum4"
replace Year = 2006 if parm == "yeardum5"
replace Year = 2007 if parm == "yeardum6"
replace Year = 2008 if parm == "yeardum7"
replace Year = 2009 if parm == "yeardum8"
replace Year = 2010 if parm == "yeardum9"
replace Year = 2011 if parm == "yeardum10"
replace Year = 2012 if parm == "yeardum11"


eclplot estimate min95 max95 Year, xtitle("Year", size(large)) yline(0, lstyle(refline))  ytitle("Grant Rate at Year" "Relative to 2002", size(large)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) 


}


***************************************************************************************************************



*********************************************************************************************************

* FIGURE A3

if "`figure_script'" == "A3" {

clear
use figures/figure_A3

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

* Figure 1
eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
}

********************************************************************************************************


*********************************************************************************************************

* FIGURE A4

if "`figure_script'" == "A4" {

clear
use figures/figure_A4

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

* Figure 1
eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
}

********************************************************************************************************


*******************************************************************************************************




**************************************************************************************************
* Figures A5

if "`figure_script'" == "A5" {

clear
use figures/figure_A5

gen flag = 0



foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_15 exp_group2_15 exp_group3_15 exp_group4_15 exp_group5_15  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"

replace Grade = 20 if parm == "exp_group1_15" 
replace Grade = 21 if parm == "exp_group2_15" 
replace Grade = 22 if parm == "exp_group3_15" 
replace Grade = 23 if parm == "exp_group4_15"
replace Grade = 24 if parm == "exp_group5_15"


eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(medium)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) 

*eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Share at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(small)) scale(.8) legend(on label(1 "Relative Obviousness Rejection Share:" "Confidence Internval") label(2 "Relative Obviousness Rejection Share:" "Mean") size(small)) 

}


**********************************************************************************************************************************





**************************************************************************************************
* Figures A7

if "`figure_script'" == "" {

clear
use figure_
gen flag = 0



foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_15 exp_group2_15 exp_group3_15 exp_group4_15 exp_group5_15  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"

replace Grade = 20 if parm == "exp_group1_15" 
replace Grade = 21 if parm == "exp_group2_15" 
replace Grade = 22 if parm == "exp_group3_15" 
replace Grade = 23 if parm == "exp_group4_15"
replace Grade = 24 if parm == "exp_group5_15"


eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(medium)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) 

*eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Share at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(small)) scale(.8) legend(on label(1 "Relative Obviousness Rejection Share:" "Confidence Internval") label(2 "Relative Obviousness Rejection Share:" "Mean") size(small)) 

}


**********************************************************************************************************************************



***************************************************************************************************


* note figure A6 was originally meant to be an appendix figure.  brought into text instead!  

if "`figure_script'" == "A6" {

clear
use figures/figure_A6

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"


eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Grant Rate at Indicated Grade/Experience" "Group Relative to GS-Level 12 / 1st" "Year Group", size(large) margin(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(medium)) 


}
*******************************************************************************************************************************


* figure A7


if "`figure_script'" == "A7" {

clear
use figures/figure_A7

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"



eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Obviousness Rejection Rate at Indicated" "Grade/Experience Group Relative to" "GS-Level 12 / 1st Year Group", size(large) margin(medium)) scale(.8) legend(on label(1 "Obviousness Rejection Rate: Confidence Interval") label(2 "Obviousness Rejection Rate: Mean") size(small)) 

}


***********************************************************************************************************************************************

if "`figure_script'" == "A8" {

clear
use figures/figure_A8

gen flag = 0



foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_15 exp_group2_15 exp_group3_15 exp_group4_15 exp_group5_15  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"

replace Grade = 20 if parm == "exp_group1_15" 
replace Grade = 21 if parm == "exp_group2_15" 
replace Grade = 22 if parm == "exp_group3_15" 
replace Grade = 23 if parm == "exp_group4_15"
replace Grade = 24 if parm == "exp_group5_15"


eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Rate at Indicated" "Grade/Experience Group Relative to" "GS-Level 12 / 1st Year Group", size(medium)) scale(.8) legend(on label(1 "Relative Obviousness Rate: Confidence Interval") label(2 "Relative Obviousness Rate: Mean") size(small)) 

*eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Share at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(small)) scale(.8) legend(on label(1 "Relative Obviousness Rejection Share:" "Confidence Internval") label(2 "Relative Obviousness Rejection Share:" "Mean") size(small)) 

}


**********************************************************************************************************************************

if "`figure_script'" == "A9" {

clear
use figures/figure_A9

gen flag = 0



foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_15 exp_group2_15 exp_group3_15 exp_group4_15 exp_group5_15  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"

replace Grade = 20 if parm == "exp_group1_15" 
replace Grade = 21 if parm == "exp_group2_15" 
replace Grade = 22 if parm == "exp_group3_15" 
replace Grade = 23 if parm == "exp_group4_15"
replace Grade = 24 if parm == "exp_group5_15"


eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Rate at Indicated" "Grade/Experience Group Relative to" "GS-Level 12 / 1st Year Group", size(medium)) scale(.8) legend(on label(1 "Relative Obviousness Rate: Confidence Interval") label(2 "Relative Obviousness Rate: Mean") size(small)) 

*eclplot estimate min95 max95 Grade, xline(0 5 10 15 20, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments within each Level)") xmtick(0(1)24) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14" 20 "GS-15") yline(0, lstyle(refline)) ytitle("Obviousness Rejection Share at Indicated Grade/Experience Group" "Relative to GS-Level 12 / 1st Year Group", size(small)) scale(.8) legend(on label(1 "Relative Obviousness Rejection Share:" "Confidence Internval") label(2 "Relative Obviousness Rejection Share:" "Mean") size(small)) 

}


**********************************************************************************************************************************






*************************************************************************************************************************************************

* FIGURE A10

if "`figure_script'" == "A10" {

clear

set obs 7
gen Grade = 1 if _n == 1
replace Grade = 2 if _n == 2
replace Grade = 3 if _n == 3
replace Grade = 4 if _n == 4
replace Grade = 5 if _n == 5
replace Grade = 6 if _n == 6
replace Grade = 7 if _n == 7


* toggle -- do in relative terms:

gen Section_102 = 0 if Grade == 1
replace Section_102 = 0.032  / (0.56)   if Grade == 2
replace Section_102 = 0.058 / (0.56)   if Grade == 3
replace Section_102 = 0.084 / (0.56)   if Grade == 4
replace Section_102 = 0.083 / (0.56)  if Grade == 5
replace Section_102 = 0.083 / (0.56)  if Grade == 6
replace Section_102 = 0.082  / (0.56)  if Grade == 7



gen Section_112 = 0 if Grade == 1
replace Section_112 = 0.012 / (0.35)  if Grade == 2
replace Section_112 =  0.039 / (0.35)  if Grade == 3
replace Section_112 =  0.070 / (0.35)   if Grade == 4
replace Section_112 =  0.078 / (0.35)   if Grade == 5
replace Section_112 =  0.075 / (0.35)   if Grade == 6
replace Section_112 =  0.070  / (0.35)  if Grade == 7



gen Section_101 = 0 if Grade == 1
replace Section_101 = 0.001 / (0.11) if Grade == 2
replace Section_101 = 0.011 / (0.11)  if Grade == 3
replace Section_101 = 0.024 / (0.11)  if Grade == 4
replace Section_101 = 0.041 / (0.11)  if Grade == 5
replace Section_101 = 0.055 / (0.11)  if Grade == 6
replace Section_101 = 0.058 / (0.11)   if Grade == 7    



gen Section_103 = 0 if Grade == 1
replace Section_103 = 0.033 / (0.72) if Grade == 2
replace Section_103 = 0.068 / (0.72)  if Grade == 3
replace Section_103 = 0.079 / (0.72)  if Grade == 4
replace Section_103 = 0.077 / (0.72)  if Grade == 5
replace Section_103 = 0.073 / (0.72)  if Grade == 6
replace Section_103 = 0.047 / (0.72)   if Grade == 7    




twoway connected Section_101 Section_102 Section_112 Section_103 Grade, msymbol(T O D X) ytitle("Relevant Rejection Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 


}


**********************************************************************************************************************************************





*************************************************************************************************************************************************

* FIGURE A11

if "`figure_script'" == "A11" {

clear

set obs 7
gen Grade = 1 if _n == 1
replace Grade = 2 if _n == 2
replace Grade = 3 if _n == 3
replace Grade = 4 if _n == 4
replace Grade = 5 if _n == 5
replace Grade = 6 if _n == 6
replace Grade = 7 if _n == 7


* toggle -- do in relative terms:

gen Section_102 = 0 if Grade == 1
replace Section_102 = 0.013  / (0.56)   if Grade == 2
replace Section_102 = 0.015 / (0.56)   if Grade == 3
replace Section_102 = 0.019 / (0.56)   if Grade == 4
replace Section_102 = 0.012 / (0.56)  if Grade == 5
replace Section_102 = 0.017 / (0.56)  if Grade == 6
replace Section_102 = 0.019  / (0.56)  if Grade == 7



gen Section_112 = 0 if Grade == 1
replace Section_112 = 0.001 / (0.35)  if Grade == 2
replace Section_112 =  0.010 / (0.35)  if Grade == 3
replace Section_112 =  0.024 / (0.35)   if Grade == 4
replace Section_112 =  0.026 / (0.35)   if Grade == 5
replace Section_112 =  0.026 / (0.35)   if Grade == 6
replace Section_112 =  0.024  / (0.35)  if Grade == 7



gen Section_101 = 0 if Grade == 1
replace Section_101 = 0.000 / (0.11) if Grade == 2
replace Section_101 = 0.003 / (0.11)  if Grade == 3
replace Section_101 = 0.009 / (0.11)  if Grade == 4
replace Section_101 = 0.017 / (0.11)  if Grade == 5
replace Section_101 = 0.025 / (0.11)  if Grade == 6
replace Section_101 = 0.026 / (0.11)   if Grade == 7    



gen Section_103 = 0 if Grade == 1
replace Section_103 = 0.020 / (0.72) if Grade == 2
replace Section_103 = 0.032 / (0.72)  if Grade == 3
replace Section_103 = 0.023 / (0.72)  if Grade == 4
replace Section_103 = 0.018 / (0.72)  if Grade == 5
replace Section_103 = 0.017 / (0.72)  if Grade == 6
replace Section_103 = -0.005 / (0.72)   if Grade == 7    




twoway connected Section_101 Section_102 Section_112 Section_103 Grade, msymbol(T O D X) ytitle("Relevant Rejection Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 


}





**********************************************************************************************************************************************


*************************************************************************************************************************************************

* FIGURE A12

if "`figure_script'" == "A12" {

clear

set obs 7
gen Grade = 1 if _n == 1
replace Grade = 2 if _n == 2
replace Grade = 3 if _n == 3
replace Grade = 4 if _n == 4
replace Grade = 5 if _n == 5
replace Grade = 6 if _n == 6
replace Grade = 7 if _n == 7


* toggle -- do in relative terms:

gen Section_102 = 0 if Grade == 1
replace Section_102 = 0.013    if Grade == 2
replace Section_102 = 0.015    if Grade == 3
replace Section_102 = 0.019    if Grade == 4
replace Section_102 = 0.012  if Grade == 5
replace Section_102 = 0.017   if Grade == 6
replace Section_102 = 0.019   if Grade == 7



gen Section_112 = 0 if Grade == 1
replace Section_112 = 0.001   if Grade == 2
replace Section_112 =  0.010  if Grade == 3
replace Section_112 =  0.024   if Grade == 4
replace Section_112 =  0.026   if Grade == 5
replace Section_112 =  0.026   if Grade == 6
replace Section_112 =  0.024  if Grade == 7



gen Section_101 = 0 if Grade == 1
replace Section_101 = 0.000  if Grade == 2
replace Section_101 = 0.003   if Grade == 3
replace Section_101 = 0.009   if Grade == 4
replace Section_101 = 0.017  if Grade == 5
replace Section_101 = 0.025   if Grade == 6
replace Section_101 = 0.026    if Grade == 7    



gen Section_103 = 0 if Grade == 1
replace Section_103 = 0.020  if Grade == 2
replace Section_103 = 0.032   if Grade == 3
replace Section_103 = 0.023   if Grade == 4
replace Section_103 = 0.018   if Grade == 5
replace Section_103 = 0.017   if Grade == 6
replace Section_103 = -0.005    if Grade == 7    



twoway connected Section_101 Section_102 Section_112 Section_103 Grade, msymbol(T O D X) ytitle("Relevant Rejection Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 


}



**********************************************************************************************************************************************




*********************************************************************************************************

* FIGURE A13

if "`figure_script'" == "A13" {

clear
use figures/figure_A13

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Number of Applicant-Originating Prior Art Citations at Indicated Grade" "Relative to GS-Level 7, Logged", size(small)) scale(.8) legend(on label(1 "Relative Applicant Prior Art Citations: Confidence Interval") label(2 "Relative Applicant Prior Art Citations: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 

}

********************************************************************************************************




*********************************************************************************************************

* FIGURE A14

if "`figure_script'" == "A14" {

clear
use figures/figure_A14

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Number of Examiner-Originating Prior Art Citations at Indicated Grade" "Relative to GS-Level 7, Logged", size(small)) scale(.8) legend(on label(1 "Relative Examiner Prior Art Citations: Confidence Interval") label(2 "Relative Examiner Prior Art Citations: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 

}

********************************************************************************************************





***********************************************************************************************************\

***********************************

if "`figure_script'" == "A15" {

clear
use figures/figure_A6

gen flag = 0

foreach lname in _cons exp_group2_12 exp_group3_12 exp_group4_12 exp_group5_12  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in   exp_group1_13_alt exp_group2_13_alt exp_group3_13_alt exp_group4_13_alt exp_group5_13_alt {
replace flag = 1 if parm == "`lname'"
}

foreach lname in exp_group1_13_alt2 exp_group2_13_alt2 exp_group3_13_alt2 exp_group4_13_alt2 exp_group5_13_alt2  {
replace flag = 1 if parm == "`lname'"
}

foreach lname in  exp_group1_14_alt exp_group2_14_alt exp_group3_14_alt exp_group4_14_alt exp_group5_14_alt  {
replace flag = 1 if parm == "`lname'"
}


keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 0 if parm == "_cons"
replace Grade = 1 if parm == "exp_group2_12" 
replace Grade = 2 if parm == "exp_group3_12" 
replace Grade = 3 if parm == "exp_group4_12"
replace Grade = 4 if parm == "exp_group5_12"

replace Grade = 5 if parm == "exp_group1_13_alt" 
replace Grade = 6 if parm == "exp_group2_13_alt" 
replace Grade = 7 if parm == "exp_group3_13_alt" 
replace Grade = 8 if parm == "exp_group4_13_alt"
replace Grade = 9 if parm == "exp_group5_13_alt"

replace Grade = 10 if parm == "exp_group1_13_alt2" 
replace Grade = 11 if parm == "exp_group2_13_alt2" 
replace Grade = 12 if parm == "exp_group3_13_alt2" 
replace Grade = 13 if parm == "exp_group4_13_alt2"
replace Grade = 14 if parm == "exp_group5_13_alt2"

replace Grade = 15 if parm == "exp_group1_14_alt" 
replace Grade = 16 if parm == "exp_group2_14_alt" 
replace Grade = 17 if parm == "exp_group3_14_alt" 
replace Grade = 18 if parm == "exp_group4_14_alt"
replace Grade = 19 if parm == "exp_group5_14_alt"


eclplot estimate min95 max95 Grade, xline(0 5 10 15, lpattern(dash) lcolor(black))  xtitle("Grade Level / Experience Group (2-Year Increments" "within each Level)", size(large) margin(small)) xmtick(0(1)19) xlabel(0 "GS-12" 5 "GS-13 (1)" 10 "GS-13(2)" 15 "GS-14") yline(0, lstyle(refline))  ytitle("Grant Rate at Indicated Grade/Experience" "Group Relative to GS-Level 12 / 1st" "Year Group", size(large) margin(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(medium)) 



}



**************************************************************************************************



*************************************************************************************************

if "`figure_script'" == "A16" {


* toggle tech number


clear
use figures/figure_tech_6

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"


gen estimate_2 = estimate

sort Grade




*twoway connected estimate_2 Grade, ytitle("") title("Agriculture, Food, Textiles", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Coating", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Gas", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Organic Compounds", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Resins", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
twoway connected estimate_2 Grade, ytitle("") title("Miscellaneous Chemical", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Communications", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Comp. Hardware & Software", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Computer Peripherals", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Information Storage", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Elec. Bus. Methods & Software", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Drugs", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Surgical and Med. Instruments", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Genetics", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Misc. Drugs and Medical", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Electrical Devices", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Electrical Lighting", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Measuring and Testing", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Nuclear & X-Rays", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Power Systems", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Semiconductor Devices", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Miscellaneous Electrical", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Miscellaneous Electrical", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Mat. Processing & Handling", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Metal Working", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Motor, Engines, Parts", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Optics", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Transportation", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Miscellaneous Mechanical", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Agriculture, Husbandry, Food", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Amusement Devices", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Apparel and Textiles", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Earth Working and Wells", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Furniture and House Fixtures", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Heating", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Pipes and Joints", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Receptacles", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
*twoway connected estimate_2 Grade, ytitle("") title("Miscellaneous Other", size(vhuge)) yline(0, lstyle(refline)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 


}



*************************************************************************************************



*********************************************************************************************************


if "`figure_script'" == "A17" {

clear
use figures/figure_redocket

gen flag = 0

foreach lname in _cons GSdum2 GSdum3 GSdum4 GSdum5_1 GSdum5_2 GSdum6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum2"
replace Grade = 3 if parm == "GSdum3"
replace Grade = 4 if parm == "GSdum4"
replace Grade = 5 if parm == "GSdum5_1"
replace Grade = 6 if parm == "GSdum5_2"
replace Grade = 7 if parm == "GSdum6_alt"

sort Grade

* Figure 1
eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
}

********************************************************************************************************



*********************************************************************************************************


if "`figure_script'" == "A18" {

clear
use figures/figure_foa

gen flag = 0

foreach lname in _cons GSdum_foa2 GSdum_foa3 GSdum_foa4 GSdum_foa5_1 GSdum_foa5_2 GSdum_foa6_alt {
replace flag = 1 if parm == "`lname'"
}

keep if flag == 1


replace estimate = 0 if parm == "_cons"
replace min95 = 0 if parm == "_cons"
replace max95 = 0 if parm == "_cons"


gen Grade = 1 if parm == "_cons"
replace Grade = 2 if parm == "GSdum_foa2"
replace Grade = 3 if parm == "GSdum_foa3"
replace Grade = 4 if parm == "GSdum_foa4"
replace Grade = 5 if parm == "GSdum_foa5_1"
replace Grade = 6 if parm == "GSdum_foa5_2"
replace Grade = 7 if parm == "GSdum_foa6_alt"

sort Grade

* Figure 1
eclplot estimate min95 max95 Grade, yline(0, lstyle(refline)) ytitle("Grant Rate at Indicated Grade Relative to GS-Level 7", size(small)) scale(.8) legend(on label(1 "Relative Grant Rate: Confidence Interval") label(2 "Relative Grant Rate: Mean") size(small)) xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14") 
}

********************************************************************************************************








****************************************************************************************************************************

if "`figure_script'" == "A19" {



use analytical_application

keep if first_year2 != 1992 & grant != .
gen total = 1
collapse (sum) total, by(experience grade_alt)

gen Grade = 1 if grade_alt == 7
replace Grade = 2 if grade_alt == 9
replace Grade = 3 if grade_alt == 11
replace Grade = 4 if grade_alt == 12
replace Grade = 5 if grade_alt == 13.1
replace Grade = 6 if grade_alt == 13.2
replace Grade = 7 if grade_alt == 14

rename experience Experience

scatter Experience Grade [aw=total], xlabel(1 "GS-7" 2 "GS-9" 3 "GS-11" 4 "GS-12" 5 "GS-13 (1)" 6 "GS-13 (2)" 7 "GS-14")




}

******************************************************************************************************************************





















